﻿using System.Net;
using System.Net.Sockets;

namespace WemoConnect1
{
    class BelkinControl
    {
        public void SendCmd(int port, WemoCommand cmd)
        {
            var localEp = new IPEndPoint(IPAddress.Parse("192.168.1.7"), 0);
            var remoteEp = new IPEndPoint(IPAddress.Parse("192.168.1.13"), port);
            using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
            {
                socket.Bind(localEp);
                socket.Connect(remoteEp);
                cmd.Execute(socket);

                socket.Close();
            }
        }
    }

    

}
